<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//平台注册绑定表
class Plat_account_model extends CI_Model{
    function __construct() {
        parent::__construct();
        $this->table = "plat_account";
    }
    
    function get_account_info($where){
        $this->db->select('*');
        $this->db->from($this->table);
        $this->db->where($where);
        $query = $this->db->get();
        return $query->row_array();
    }
    function get_account_list($where,$page,$limit){
        $this->db->select("*");
        $this->db->from($this->table);
        $this->db->where($where);
        $this->db->order_by('id','desc');
        $this->db->limit($limit, $page);
        return $this->db->get()->result_array();
    }
    
    function get_account_count($where){
        $this->db->select('*');
        $this->db->from($this->table);
        $this->db->where($where);
        $query = $this->db->get();
        return $query->num_rows();
    }
     //插入数据
    function insert($data)
    {
            $this->db->insert($this->table, $data);
            if($this->db->affected_rows()){
               return $this->db->insert_id();
            }else{
                return 0;
            }
    }
    //更新数据
    function update($data,$id)
    {
            return $this->db->where('id',$id)->update($this->table, $data);
    }
    //删除数据
    function delete($delid)
    {	
            $this->db->where('id',$delid);
            $this->db->delete($this->table);
            return $this->db->affected_rows();
    }
}
